<template>
  <div class="page_monitor-add">
    <!-- 页面title -->
    <!--    <div class="page-title">边坡技术评定调查表</div>-->
    <el-form ref="form" :rules="rules" label-position="right" :model="currentRow" label-suffix="：" label-width="140px"
             style="box-shadow: 0 0 10px 10px rgb(0 0 0 / 3%)">
      <el-card style="padding: 20px">
        <el-divider><span style="font-size: 25px;color: #1990FE">基本信息</span></el-divider>
        <div v-if="isLook">
          <el-row :gutter="20">
            <el-col :span="12">
              <p><span class="label_view">边坡名称:</span><span class="info_view">{{currentRow.name}}</span></p>
              <p><span class="label_view">边坡编号:</span><span class="info_view">{{currentRow.damageNo}}</span></p>
              <p><span class="label_view">路线:</span><span
                class="info_view">{{currentRow.roadCode}}{{currentRow.roadName}}</span></p>
              <p><span class="label_view">管养单位:</span><span class="info_view">{{currentRow.deptName}}</span></p>
            </el-col>
            <el-col :span="12">
              <p><span class="label_view">评估单位:</span><span class="info_view">{{currentRow.unitName}}</span></p>
              <p><span class="label_view">评估人:</span><span class="info_view">{{currentRow.userName}}</span></p>
              <p><span class="label_view">评估时间:</span><span
                class="info_view">{{currentRow.createTime | formatTimer}}</span>
              </p>
              <p><span class="label_view">评估次序:</span><span class="info_view">{{currentRow.count}}</span></p>
            </el-col>
          </el-row>
        </div>
        <div v-else>
          <el-form-item label="管养单位" prop="deptTreeId">
            <organization
              v-model="currentRow.deptTreeId"
              placeholder="选择管养单位"
              @change="changeDept"
            ></organization>
          </el-form-item>
          <el-row>
            <el-col :span="12">
              <el-form-item label="路线" prop="roadId">
                <el-select
                  :popper-append-to-body="false"
                  v-model="currentRow.roadId"
                  clearable
                  filterable
                  placeholder="选择路线"
                  @change="changeRoad">
                  <el-option
                    v-for="item in roadSelectList"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id">
                  </el-option>
                </el-select>
              </el-form-item>

            </el-col>
            <el-col :span="12">
              <el-form-item label="选择边坡" prop="slopeId">
                <el-select
                  :popper-append-to-body="false"
                  v-model="currentRow.slopeId"
                  filterable
                  clearable
                  placeholder="选择边坡" @change="changeSlope">
                  <el-option
                    v-for="item in slopeSelectList"
                    :key="item.id"
                    :label="item.name"
                    :value="item.id">
                  </el-option>
                </el-select>
              </el-form-item>

            </el-col>
          </el-row>
          <el-row class="investigationBox">
            <el-col :span="8">
              <el-form-item label="调查单位" prop="investigationDeptTreeId">
                <organization
                  v-model="currentRow.investigationDeptTreeId"
                  placeholder="选择调查单位"
                  @change="changeDept"
                ></organization>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="调查时间" prop="investigationTime">
                <el-date-picker
                  v-model="currentRow.investigationTime"
                  type="date"
                  placeholder="选择时间">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="调查人" prop="investigator">
                <el-input v-model="currentRow.investigator" clearable placeholder=""></el-input>
              </el-form-item>
            </el-col>

          </el-row>
        </div>
        <el-divider><span style="font-size: 25px;color: #1990FE">单项控制指标</span></el-divider>
        <el-form-item label="" prop="singleControl">
          <el-radio-group v-model="currentRow.singleControl">
            <el-radio @click.native.prevent="changeSingleControl(item.code)"
                      v-for="item in EnumTechniqueSingleControlList" :key="item.code" :label="item.code">{{item.name}}
            </el-radio>
          </el-radio-group>
        </el-form-item>
        <div v-if="!currentRow.singleControl">
          <el-divider><span style="font-size: 25px;color: #1990FE">调查内容</span></el-divider>
          <el-card class="paicha_view">
            <el-tabs v-model="activeName">
              <el-tab-pane
                v-for="item in template"
                :key="item.id"
                :label="item.name"
                :name="item.name">
                <div v-if="item.name === '(B)坡体'">
                  <el-collapse v-model="collapseActiveName1" @change="(val)=>onChangeCollapse(val,1)" accordion>
                    <el-collapse-item :title="child1.name" :name="child1.name" v-for="child1 in item.childList"
                                      :key="child1.id">
                      <div v-for="child2 in child1.childList" :key="child2.id" style="width: 50%;display: inline-block">
                        <div v-if="child2.mathTypeName === '单选'" id="divOne">
                          <el-form-item>
                            <span slot="label">
                               <el-popover
                                 placement="top"
                                 trigger="click">
                                  <el-image :src="require(tips.img + '')"
                                            fit="contain"></el-image>
                              <i slot="reference" class="el-icon-question tips" v-if="child2.name === '标度'"
                                 @click="showTips(child1.name)"></i>
                            </el-popover>
                              {{child2.name}}</span>
                            <el-select
                              :disabled="isLook"
                              v-model="child2.value"
                              filterable
                              clearable
                              @change="((val)=>{changeSingleInput(val,[item,child1,child2])})">
                              <el-option
                                v-for="option in child2.childList"
                                :key="option.id?option.id:option.code"
                                :label="option.name"
                                :value="option.id?option.id:option.code">
                              </el-option>
                            </el-select>
                          </el-form-item>

                        </div>
                        <table style="width: 200%;margin-left: -100%">
                          <tr class="tableHeader">
                            <th v-for="(child3,index) in child2.inputList" :key="index" :class="{'lastTh':!index}">
                              {{child3.name}}
                            </th>
                          </tr>
                          <tr>
                            <td v-for="child3 in child2.inputList" :key="child3.id">
                              <el-input :disabled="isLook"
                                        size="mini"
                                        v-model.trim="child3.value"

                                        :type="child3.inputTypeName === '数字' ? 'number' : ''"
                                        style="width:70%">

                              </el-input>
                              {{child3.nameAppend?child3.nameAppend:''}}
                            </td>
                          </tr>
                        </table>
                        <div v-if="child2.mathTypeName === '列表'" class="list_view">
                          <el-button type="primary" class="btnWeiZhi"
                                     style="margin-top: 10px;width: 28%"
                                     @click="addList([item,child1,child2])">添加位置信息
                          </el-button>
                          <table v-for="(child3,index1) in child2.itemList" :key="index1+1" v-show="index1===0"
                                 style="width: 200%">
                            <tr>
                              <th width="50px">序号</th>
                              <th v-for="(child4,index2) in child3" :key="index2+1">
                                <div v-if="child4.mathTypeName !== '不计分'">
                                  {{child4.name}}
                                </div>
                                <div v-else>
                                  位置描述
                                </div>
                              </th>
                              <th>
                                操作
                              </th>
                            </tr>
                            <tr v-for="(child3,index1) in child2.itemList" :key="index1+1">
                              <td>{{index1+1}}</td>
                              <td v-for="(child4,index2) in child3" :key="index2"
                                  :class="{'picTd':child4.mathTypeName === '照片'}">
                                <div v-if="child4.mathTypeName === '不计分'">
                                  <div v-for="(child5,index3) in child4.childList" :key="index3"
                                       style="width: 40%;display: inline-block;;line-height: 40px;height: 40px">
                                    <div v-if="child5.mathTypeName === '填写'">
                                      <el-form-item label-width="0">
                                        <el-input :disabled="isLook"
                                                  size="mini"
                                                  v-model.trim="child5.value"
                                                  :type="child5.inputTypeName === '数字' ? 'number' : ''"
                                                  style="width: 60%">
                                          <template slot="prepend">{{child5.name}}</template>
                                          <template slot="append">{{child5.nameAppend?child5.nameAppend:''}}
                                          </template>
                                        </el-input>
                                      </el-form-item>
                                    </div>
                                    <div v-if="child5.mathTypeName === '单选'">
                                      <el-row class="el-row1" style="height: 100%;margin-top: 10px">
                                        <el-col :span="12">{{child5.name}}</el-col>
                                        <el-col :span="12">
                                          <el-select
                                            :disabled="isLook" size="small"
                                            v-model="child5.value">
                                            <el-option
                                              v-for="option in child5.childList"
                                              :key="option.id?option.id:option.code"
                                              :label="option.name"
                                              :value="option.id?option.id:option.code">
                                            </el-option>
                                          </el-select>


                                        </el-col>
                                      </el-row>
                                      <el-row>

                                      </el-row>

                                    </div>
                                  </div>
                                </div>
                                <div v-if="child4.mathTypeName === '填写'">
                                  <el-form-item label-width="0">
                                    <el-input :disabled="isLook"
                                              size="mini"
                                              v-model.trim="child4.value"

                                              :type="child4.inputTypeName === '数字' ? 'number' : ''"
                                              style="width: 80%">
                                      <template slot="prepend">{{child4.name}}</template>
                                      <template slot="append">{{child4.nameAppend?child4.nameAppend:''}}
                                      </template>
                                    </el-input>
                                  </el-form-item>
                                </div>
                                <div v-if="child4.mathTypeName === '单选'">
                                  <div style="width: 100%">
                                    <el-radio-group :disabled="isLook" size="mini" v-model="child4.value"
                                                    @change="((val)=>{changeListSingleInput(val,child4.childList,[item,child1,child2],index1,index2)})"
                                    >
                                      <el-radio-button
                                        v-for="option in child4.childList"
                                        :key="option.id?option.id:option.code"
                                        :label="option.id?option.id:option.code">
                                        {{ option.name }}
                                      </el-radio-button>
                                    </el-radio-group>

                                  </div>
                                  <!-- 单选对应的输入框-->
                                  <div v-for="child5 in child4.inputList" :key="child5.id"
                                       style=" width: 120px;display: inline-block">
                                    <div v-if="child5.mathTypeName === '填写'"
                                         style="display: inline-block;margin-bottom: 2px;width: 100%">
                                      <el-form-item label-width="0">
                                        <el-input :disabled="isLook"
                                                  size="mini"
                                                  v-model.trim="child5.value"

                                                  :type="child5.inputTypeName === '数字' ? 'number' : ''"
                                                  @mousewheel.native.prevent
                                                  @DOMMouseScroll.native.prevent
                                                  style="width:100%">
                                          <template slot="prepend">{{child5.name}}</template>
                                          <template slot="append">{{child5.nameAppend?child5.nameAppend:''}}
                                          </template>
                                        </el-input>
                                      </el-form-item>
                                    </div>
                                  </div>
                                </div>
                                <div v-if="child4.mathTypeName === '照片'">
                                  {{child4.pic}}
                                  <div v-if="child4.pic && child4.pic.url" class="picBox1">
                                    <el-button v-if="!isLook" type="danger" icon="el-icon-delete" circle
                                               @click="deletePic([item,child1,child2],index1,index2)"
                                               style="font-size:16px">
                                    </el-button>
                                    <el-image
                                      @click="_previewImg(0,child4.pic)"
                                      style="height: 50px"
                                      fit="scale-down"
                                      :src="constUrl + child4.pic.url"></el-image>
                                  </div>
                                  <upload-img
                                    v-else
                                    trigger="button"
                                    :size-limit="5"
                                    v-model="child4.url"
                                    @update="setFormImg(child4.url,[item,child1,child2],index1,index2)"></upload-img>
                                  <div v-if="child4.pic" class="pic-no-view"> {{child4.pic.name}}</div>


                                </div>
                              </td>
                              <td>
                                <el-button type="text"
                                           @click="(targetName)=>removeTab([item,child1,child2],targetName)"
                                           style="color: red">
                                  删除
                                </el-button>
                              </td>

                            </tr>
                          </table>


                        </div>
                      </div>
                    </el-collapse-item>
                  </el-collapse>
                </div>
                <div v-if="item.name === '(S)支护'">
                  <div v-for="child1 in item.childList" :key="child1.id">
                    <div v-if="child1.name === '选择支护措施'">
                      <el-form-item label="选择支护措施">
                        <el-checkbox-group size="small" :max="5" v-model="child1.valueList"
                                           @change="((val)=>{changeZhiHu(val,item)})">
                          <el-checkbox-button
                            v-for="option1 in child1.childList"
                            :key="option1.code+ ''"
                            :label="option1.code+ ''">{{ option1.name }}
                          </el-checkbox-button>
                        </el-checkbox-group>
                      </el-form-item>
                    </div>
                    <div v-else>
                      <el-collapse v-model="collapseActiveName1" @change="(val)=>onChangeCollapse(val,1)">
                        <el-collapse-item v-show="child1.show" :title="child1.name" :name="child1.name">
                          <el-form-item class="divTwo" style="padding-bottom: 10px">
                              <span slot="label">
                               <el-popover
                                 placement="top"
                                 trigger="click">
                                  <el-image :src="require(tips.img + '')"
                                            fit="contain"></el-image>
                              <i slot="reference" class="el-icon-question tips" @click="showTips('权重')"></i>
                            </el-popover>
                              权重</span>
                            <el-radio-group :disabled="isLook" v-model="child1.weight" @change="quanz(child1.weight)">
                              <el-radio-button
                                v-for="option in weightList" :key="option.code"
                                :label="option.code"
                                :disabled="option.disabled">
                                {{ option.name }}
                              </el-radio-button>
                            </el-radio-group>
                          </el-form-item>
                          <el-form-item class="divTwo" style="padding-bottom: 10px"
                                        v-if="child1.name==='(C4)窗式(浆砌)护面墙'">
                            <el-radio-group :disabled="isLook" v-model="child1.isJiang"
                                            @change="((val)=>{changeJiang(val,[item,child1])})">
                              <el-radio-button label="1">浆砌片石墙面</el-radio-button>
                              <el-radio-button label="0">非浆砌片石墙面</el-radio-button>
                            </el-radio-group>
                          </el-form-item>
                          <div class="collapse_view2">
                            <el-collapse v-model="collapseActiveName2" @change="(val)=>onChangeCollapse(val,2)"
                                         accordion>
                              <el-collapse-item v-for="child2 in child1.childList" :title="child2.name" :key="child2.id"
                                                :name="child2.name"
                                                v-show="(child2.name==='(C42)鼓胀(浆砌片石挡墙)' && child1.isJiang === '1') ||
                                                (child2.name==='(C41)墙体开裂' && child1.isJiang) ||
                                                 (child2.name!=='(C42)鼓胀(浆砌片石挡墙)' && child2.name!=='(C41)墙体开裂')">
                                <div v-for="child3 in child2.childList" :key="child3.id"
                                     style="margin-top: 10px;width: 50%;display: inline-block">
                                  <div v-if="child3.mathTypeName === '单选'" class="divTwo">
                                    <el-form-item label-width="180px">
                                      <span slot="label">
                                      <el-popover placement="top" trigger="click">
                                        <el-image :src="require(tips.img + '')" fit="contain"></el-image>
                                         <i slot="reference" class="el-icon-question tips" v-if="child3.name === '标度'"
                                            @click="showTips(child2.name)"></i>
                                      </el-popover>{{child3.name}}</span>
                                      <el-select
                                        filterable
                                        clearable
                                        :disabled="isLook"
                                        v-model="child3.value"
                                        @change="((val)=>{changeSingleInput(val,[item,child1,child2,child3])})">
                                        <el-option
                                          v-for="option in child3.childList"
                                          :key="option.id?option.id:option.code"
                                          :label="option.name"
                                          :value="option.id?option.id:option.code">
                                        </el-option>
                                      </el-select>
                                    </el-form-item>
                                    <!-- 单选对应的输入框-->
                                    <table style="width: 200%;margin-left: -100%">
                                      <tr class="tableHeader">
                                        <th v-for="(child4,index) in child3.inputList" :key="child4.id"
                                            :class="{'lastTh':!index}">
                                          {{child4.name}}
                                        </th>
                                      </tr>
                                      <tr>
                                        <td v-for="child4 in child3.inputList" :key="child4.id">
                                          <el-input :disabled="isLook"
                                                    size="mini"
                                                    v-model.trim="child4.value"

                                                    :type="child4.inputTypeName === '数字' ? 'number' : ''"
                                                    style="width:70%">
                                          </el-input>
                                          {{child4.nameAppend?child4.nameAppend:''}}
                                        </td>
                                      </tr>
                                    </table>
                                  </div>
                                  <!-- 不能放在单选里面不然 会因为判断不显示-->
                                  <div v-if="child3.mathTypeName === '计算填写'" style="width:  100%;height: 40px;">
                                    <div style="width: 100%">
                                      <div>
                                        <span style="color: #1990FE  ;margin-right: 10px;">{{child3.name}}</span>
                                        <el-input :disabled="isLook"
                                                  size="mini"
                                                  v-model.trim="child3.value"
                                                  :type="child2.inputTypeName === '数字' ? 'number' : ''"
                                                  style="width:70%"
                                        >
                                        </el-input>
                                      </div>
                                    </div>
                                  </div>
                                  <div v-if="child3.mathTypeName === '填写'">
                                    <div style="width: 100%;">
                                      <div>

                                        <el-input :disabled="isLook"
                                                  size="mini"
                                                  v-model.trim="child3.value"
                                                  :type="child2.inputTypeName === '数字' ? 'number' : ''"
                                                  style="width:40%"
                                        >
                                          <template slot="prepend">{{child3.name}}</template>
                                          <template slot="append">{{child3.nameAppend?child3.nameAppend:''}}
                                          </template>
                                        </el-input>
                                      </div>
                                    </div>
                                  </div>
                                </div>
                                <div v-for="(child3,index3) in child2.childList" :key="index3">
                                  <div v-if="child3.mathTypeName === '列表'" class="list_view">
                                    <el-button type="primary"
                                               class="btnWeiZhi"
                                               @click="addList([item,child1,child2,child3])">添加位置信息
                                    </el-button>
                                    <table v-for="(child4,index1) in child3.itemList" :key="index1" v-show="index1===0">
                                      <tr>
                                        <th width="50px">序号</th>
                                        <th v-for="(child5,index2) in child4" :key="index2">
                                          <div v-if="child5.mathTypeName !== '不计分'">
                                            <el-popover placement="top" trigger="click">
                                              <el-image :src="require(tips.img + '')" fit="contain"></el-image>
                                              <i slot="reference" class="el-icon-question tips"
                                                 v-if="child5.name === '受损锚头标度' || child5.name === '标度'"
                                                 @click="showTips(child2.name)"></i>
                                            </el-popover>
                                            {{child5.name}}
                                          </div>
                                          <div v-else>
                                            位置描述
                                          </div>
                                        </th>
                                        <th>
                                          操作
                                        </th>
                                      </tr>
                                      <tr v-for="(child4,index1) in child3.itemList" :key="index1+1">
                                        <td>{{index1+1}}</td>
                                        <td v-for="(child5,index2) in child4" :key="index2"
                                            :class="{'picTd':child5.mathTypeName === '照片'}">
                                          <div v-if="child5.mathTypeName === '不计分'">
                                            <div style="width: 50%;display: inline-block;height: 40px;line-height: 40px"
                                                 v-for="(child6,index3) in child5.childList" :key="index3">
                                              <div v-if="child6.mathTypeName === '填写'">
                                                <el-form-item label-width="0" style="width: 80%;">
                                                  <el-input :disabled="isLook"
                                                            size="mini"
                                                            v-model.trim="child6.value"
                                                            :type="child6.inputTypeName === '数字' ? 'number' : ''"
                                                            style="width: 80%;margin-top: 10px">
                                                    <template slot="prepend">{{child6.name}}</template>
                                                    <template slot="append">{{child6.nameAppend?child6.nameAppend:''}}
                                                    </template>
                                                  </el-input>
                                                </el-form-item>
                                              </div>
                                              <div v-if="child6.mathTypeName === '单选'" style="width: 80%">
                                                <el-row :gutter="10" class="el-row1"
                                                        style="background: transparent;margin-top:16px">
                                                  <el-col :span="6">{{child6.name}}</el-col>
                                                  <el-col :span="18">
                                                    <el-select
                                                      filterable
                                                      clearable
                                                      :disabled="isLook" size="small"
                                                      v-model="child6.value">
                                                      <el-option
                                                        v-for="option in child6.childList"
                                                        :key="option.id?option.id:option.code"
                                                        :label="option.name"
                                                        :value="option.id?option.id:option.code">
                                                      </el-option>
                                                    </el-select>
                                                  </el-col>
                                                </el-row>
                                              </div>
                                            </div>
                                          </div>
                                          <div v-if="child5.mathTypeName === '填写'">
                                            <el-form-item label-width="0">
                                              <el-input :disabled="isLook"
                                                        size="mini"
                                                        v-model.trim="child5.value"
                                                        :type="child5.inputTypeName === '数字' ? 'number' : ''"
                                                        style="width: 80%">
                                                <template slot="prepend">{{child5.name}}</template>
                                                <template slot="append">{{child5.nameAppend?child5.nameAppend:''}}
                                                </template>
                                              </el-input>
                                            </el-form-item>
                                          </div>
                                          <div v-if="child5.mathTypeName === '单选'" style="display: inline-block">
                                            <el-select
                                              filterable
                                              clearable
                                              :disabled="isLook" style="width: 100%" size="mini"
                                              v-model="child5.value"
                                              @change="((val)=>{changeListSingleInput(val,child5.childList,[item,child1,child2,child3],index1,index2)})">
                                              <el-option
                                                v-for="option in child5.childList"
                                                :key="option.id?option.id:option.code"
                                                :label="option.name"
                                                :value="option.id?option.id:option.code">
                                              </el-option>
                                            </el-select>
                                            <!-- 单选对应的输入框-->
                                            <div v-for="child6 in child5.inputList" :key="child6.id"
                                                 style=" width: 170px;display: inline-block">
                                              <div v-if="child6.mathTypeName === '填写'">
                                                <el-form-item label-width="0">
                                                  <el-input :disabled="isLook"
                                                            size="mini"
                                                            v-model.trim="child6.value"
                                                            :type="child5.inputTypeName === '数字' ? 'number' : ''"
                                                            style="width: 100%">
                                                    <template slot="prepend">{{child6.name}}</template>
                                                    <template slot="append">{{child6.nameAppend?child6.nameAppend:''}}
                                                    </template>
                                                  </el-input>
                                                </el-form-item>
                                              </div>
                                            </div>
                                          </div>
                                          <div v-if="child5.mathTypeName === '照片'">

                                            <div v-if="child5.pic && child5.pic.url" class="picBox1">

                                              <el-button v-if="!isLook" type="danger" icon="el-icon-delete" circle
                                                         @click="deletePic([item,child1,child2,child3],index1,index2)"
                                                         style="font-size:16px">

                                              </el-button>

                                              <el-image
                                                @click="_previewImg(0,child5.pic)"
                                                style="height: 50px"
                                                fit="scale-down"
                                                :src="constUrl + child5.pic.url"></el-image>


                                            </div>
                                            <upload-img
                                              v-else
                                              trigger="button"
                                              :size-limit="5"
                                              v-model="child5.url"
                                              @update="setFormImg(child5.url,[item,child1,child2,child3],index1,index2)"></upload-img>
                                            <div v-if="child5.pic" class="pic-no-view"> {{child5.pic.name}}</div>
                                          </div>

                                        </td>
                                        <td>
                                          <el-button type="text"
                                                     @click="(targetName)=>removeTab([item,child1,child2,child3],targetName)"
                                                     style="color: red">
                                            删除
                                          </el-button>
                                        </td>
                                      </tr>
                                    </table>
                                  </div>
                                </div>
                              </el-collapse-item>
                            </el-collapse>
                          </div>
                        </el-collapse-item>
                      </el-collapse>
                    </div>
                  </div>
                </div>
                <div v-if="item.name === '(D)截排水设施'">

                  <div v-for="child1 in item.childList" :key="child1.id">
                    <div v-if="child1.name === '选择截排水设施'">
                      <el-row>
                        <el-col :span="1">
                          <el-popover
                            placement="top"
                            trigger="click">
                            <el-image :src="require(tips.img + '')"
                                      fit="contain"></el-image>
                            <i slot="reference" class="el-icon-question tips" style="margin-top: 10px"
                               @click="showTips('选择截排水设施')"></i>
                          </el-popover>
                        </el-col>
                        <el-col :span="23">
                          <el-form-item label="选择截排水设施">
                            <el-checkbox-group size="small" :max="5" v-model="child1.valueList"
                                               @change="((val)=>{changeJiePaiShui(val,item)})">
                              <el-checkbox-button
                                v-for="option1 in child1.childList"
                                :key="option1.code+ ''"
                                :label="option1.code+ ''"

                              >{{ option1.name }}
                              </el-checkbox-button>
                            </el-checkbox-group>
                          </el-form-item>
                        </el-col>
                      </el-row>

                    </div>
                    <div v-else>
                      <el-collapse v-model="collapseActiveName2" @change="(val)=>onChangeCollapse(val,2)" accordion>

                        <el-collapse-item v-show="child1.show" :title="child1.name" :name="child1.name">
                          <div v-for="child2 in child1.childList" :key="child2.id"
                               :class="{'fillWrite':child2.mathTypeName === '填写'}"
                               style="width: 50%;display: inline-block">
                            <div v-if="child2.mathTypeName === '单选'"
                                 class="divTwo">
                              <el-form-item label-width="160px">
                               <span slot="label">
                               <el-popover
                                 placement="top"
                                 trigger="click">
                                  <el-image :src="require(tips.img + '')"
                                            fit="contain"></el-image>
                              <i slot="reference" class="el-icon-question tips" v-if="child2.name === '标度'"
                                 @click="showTips(child1.name)"></i>
                            </el-popover>
                              {{child2.name}}</span>
                                <el-select
                                  filterable
                                  clearable
                                  :disabled="isLook" size="small"
                                  v-model="child2.value"
                                  @change="((val)=>{changeSingleInput(val,[item,child1,child2])})">
                                  <el-option
                                    v-for="option in child2.childList"
                                    :key="option.id?option.id:option.code"
                                    :label="option.name"
                                    :value="option.id?option.id:option.code">
                                  </el-option>
                                </el-select>
                              </el-form-item>
                            </div>
                            <table style="width: 200%;margin-left: -100%" v-if="child2.mathTypeName === '单选'">
                              <tr class="tableHeader">
                                <th v-for="(child3,index) in child2.inputList" :key="index" :class="{'lastTh':!index}">
                                  {{child3.name}}
                                </th>
                              </tr>
                              <tr>
                                <td v-for="child3 in child2.inputList" :key="child3.id">
                                  <el-input :disabled="isLook"
                                            size="mini"
                                            v-model.trim="child3.value"
                                            :type="child3.inputTypeName === '数字' ? 'number' : ''"
                                            style="width:70%">

                                  </el-input>
                                  {{child3.nameAppend?child3.nameAppend:''}}
                                </td>
                              </tr>
                            </table>
                            <div v-if="child2.mathTypeName === '计算填写'"
                                 style="width:  100%;height: 50px;margin-top: 10px">
                              <div style="width: 100%">
                                <div>
                                  <span style="color: #1990FE  ;margin-right: 10px;">{{child2.name}}</span>


                                  <el-input :disabled="isLook"
                                            size="mini"
                                            v-model.trim="child2.value"
                                            :type="child2.inputTypeName === '数字' ? 'number' : ''"
                                            style="width:70%">
                                  </el-input>
                                </div>
                              </div>
                            </div>
                            <div v-if="child2.mathTypeName === '填写'">
                              <div style="width: 100%;">
                                <div>
                                  <span style="color: #1990FE  ;margin-right: 10px;display: inline-block;width: 120px">{{child2.name}}</span>
                                  <el-input :disabled="isLook"
                                            size="mini"
                                            v-model.trim="child2.value"
                                            :type="child2.inputTypeName === '数字' ? 'number' : ''"
                                            style="width:40%"
                                  >
                                  </el-input>
                                </div>
                              </div>
                            </div>
                          </div>
                          <div v-for="(child2,index1) in child1.childList" :key="index1">
                            <div v-if="child2.mathTypeName === '列表'" class="list_view">
                              <el-button type="primary" class="btnWeiZhi"
                                         @click="addList([item,child1,child2])" style="margin-top: 20px">添加位置信息
                              </el-button>
                              <table v-for="(child3,index1) in child2.itemList" :key="index1+1" v-show="index1===0">
                                <tr>
                                  <th width="50px">序号</th>
                                  <th v-for="(child4,index2) in child3" :key="index2+1">
                                    <div v-if="child4.mathTypeName !== '不计分'">
                                      <el-popover placement="top" trigger="click">
                                        <el-image :src="require(tips.img + '')" fit="contain"></el-image>
                                        <i slot="reference" class="el-icon-question tips"
                                           v-if="child4.name === '标度'" @click="showTips(child1.name)"></i>
                                      </el-popover>
                                      {{child4.name}}
                                    </div>
                                    <div v-else>
                                      位置描述
                                    </div>
                                  </th>
                                  <th>
                                    操作
                                  </th>
                                </tr>
                                <tr v-for="(child3,index1) in child2.itemList" :key="index1+1">
                                  <td>{{index1+1}}</td>
                                  <td v-for="(child4,index2) in child3" :key="index2"
                                      :class="{'picTd':child4.mathTypeName === '照片','radioTd':child4.inputList==''}">
                                    <div v-if="child4.mathTypeName === '不计分'">
                                      <div v-for="(child5,index3) in child4.childList" :key="index3"
                                           style="width: 50%;display: inline-block">
                                        <div v-if="child5.mathTypeName === '填写'">
                                          <el-form-item label-width="0">
                                            <el-input :disabled="isLook"
                                                      size="mini"
                                                      v-model.trim="child5.value"
                                                      :type="child5.inputTypeName === '数字' ? 'number' : ''"
                                                      style="width: 50%">
                                              <template slot="prepend">{{child5.name}}</template>
                                              <template slot="append">{{child5.nameAppend?child5.nameAppend:''}}
                                              </template>
                                            </el-input>
                                          </el-form-item>
                                        </div>
                                        <div v-if="child5.mathTypeName === '单选'">
                                          <el-row class="el-row1" style="background:transparent;">
                                            <el-col style="height: 28px" :span="6">{{child5.name}}</el-col>
                                            <el-col style="height: 28px" :span="18">
                                              <el-select
                                                filterable
                                                clearable
                                                :disabled="isLook" size="small"
                                                v-model="child5.value">
                                                <el-option
                                                  v-for="option in child5.childList"
                                                  :key="option.id?option.id:option.code"
                                                  :label="option.name"
                                                  :value="option.id?option.id:option.code">
                                                </el-option>
                                              </el-select>
                                            </el-col>
                                          </el-row>
                                        </div>
                                      </div>
                                    </div>
                                    <div v-if="child4.mathTypeName === '填写'">
                                      <el-form-item label-width="0">
                                        <el-input :disabled="isLook"
                                                  size="mini"
                                                  v-model.trim="child4.value"
                                                  :type="child4.inputTypeName === '数字' ? 'number' : ''"
                                                  style="width: 80%">
                                          <template slot="prepend">{{child4.name}}</template>
                                          <template slot="append">{{child4.nameAppend?child4.nameAppend:''}}</template>
                                        </el-input>
                                      </el-form-item>
                                    </div>
                                    <div v-if="child4.mathTypeName === '单选'">

                                      <el-radio-group :disabled="isLook" size="mini" v-model="child4.value"
                                                      style="width: 100%"
                                                      @change="((val)=>{changeListSingleInput(val,child4.childList,[item,child1,child2],index1,index2)})"
                                      >
                                        <el-radio-button

                                          v-for="option in child4.childList"
                                          :key="option.id?option.id:option.code"
                                          :label="option.id?option.id:option.code">
                                          {{ option.name }}
                                        </el-radio-button>
                                      </el-radio-group>


                                      <!-- 单选对应的输入框-->
                                      <div v-for="child5 in child4.inputList" :key="child5.id"
                                           style=" width: 120px;display: inline-block">
                                        <div v-if="child5.mathTypeName === '填写'"
                                             style="display: inline-block;margin-bottom: 2px;width: 100%">
                                          <el-form-item label-width="0">
                                            <el-input :disabled="isLook"
                                                      size="mini"
                                                      v-model.trim="child5.value"
                                                      :type="child5.inputTypeName === '数字' ? 'number' : ''"
                                                      style="width: 100%">
                                              <template slot="prepend">{{child5.name}}</template>
                                              <template slot="append">{{child5.nameAppend?child5.nameAppend:''}}
                                              </template>
                                            </el-input>
                                          </el-form-item>
                                        </div>
                                      </div>
                                    </div>
                                    <div v-if="child4.mathTypeName === '照片'">

                                      <div v-if="child4.pic && child4.pic.url" class="picBox1">

                                        <el-button v-if="!isLook" type="danger" icon="el-icon-delete" circle
                                                   @click="deletePic([item,child1,child2],index1,index2)"
                                                   style="font-size:16px">

                                        </el-button>
                                        <el-image
                                          @click="_previewImg(0,child4.pic)"
                                          style="height: 50px"
                                          fit="scale-down"
                                          :src="constUrl + child4.pic.url"></el-image>
                                      </div>
                                      <upload-img
                                        v-else
                                        trigger="button"
                                        :size-limit="5"
                                        v-model="child4.url"
                                        @update="setFormImg(child4.url,[item,child1,child2],index1,index2)"></upload-img>

                                      <div v-if="child4.pic" class="pic-no-view"> {{child4.pic.name}}</div>
                                    </div>
                                  </td>
                                  <td>
                                    <el-button type="text"
                                               @click="(targetName)=>removeTab([item,child1,child2],targetName)"
                                               style="color: red">
                                      删除
                                    </el-button>
                                  </td>

                                </tr>
                              </table>

                            </div>
                          </div>

                        </el-collapse-item>
                      </el-collapse>
                    </div>
                  </div>

                </div>
                <div v-if="item.name === '(C)坡面防护'">
                  <div v-for="child1 in item.childList" :key="child1.id">
                    <div v-if="child1.name === '选择坡面防护'">
                      <el-form-item label="选择坡面防护">
                        <el-checkbox-group size="small" :max="5" v-model="child1.valueList"
                                           @change="((val)=>{changePoMianFangHu(val,item)})">
                          <el-checkbox-button
                            v-for="option1 in child1.childList"
                            :key="option1.code+ ''"
                            :label="option1.code+ ''">{{ option1.name }}
                          </el-checkbox-button>
                        </el-checkbox-group>
                      </el-form-item>
                    </div>
                    <div v-else>
                      <el-collapse v-model="collapseActiveName1" @change="(val)=>onChangeCollapse(val,1)" accordion>
                        <el-collapse-item v-show="child1.show" :title="child1.name" :name="child1.name">
                          <div v-if="child1.mathTypeName === '累加'">
                            <el-row :gutter="20">
                              <el-col :span="24">
                                <div v-for="(child2,index1) in child1.childList" :key="index1"
                                     style="width: 50%;display: inline-block">
                                  <div v-if="child2.mathTypeName === '单选'" class="divTwo">
                                    <el-form-item label-width="180px">
                                    <span slot="label">
                                    <el-popover
                                      placement="top"
                                      trigger="click">
                                      <el-image :src="require(tips.img + '')"
                                                fit="contain"></el-image>
                                  <i slot="reference" class="el-icon-question tips" v-if="child2.name === '标度'"
                                     @click="showTips(child1.name)"></i>
                                </el-popover>
                                  {{child2.name}}</span>
                                      <el-select
                                        filterable
                                        clearable
                                        :disabled="isLook" size="small"
                                        v-model="child2.value"
                                        @change="((val)=>{changeSingleInput(val,[item,child1,child2])})">
                                        <el-option
                                          v-for="option in child2.childList"
                                          :key="option.id?option.id:option.code"
                                          :label="option.name"
                                          :value="option.id?option.id:option.code">
                                        </el-option>
                                      </el-select>
                                    </el-form-item>
                                    <!-- 单选对应的输入框-->
                                    <div v-for="(child3,index1) in child1.childList" :key="index1">
                                      <div v-if="child3.mathTypeName === '填写'">
                                        <el-form-item label-width="0">
                                          <el-input :disabled="isLook"
                                                    size="mini"
                                                    v-model.trim="child3.value"
                                                    :type="child3.inputTypeName === '数字' ? 'number' : ''"
                                                    style="width: 80%">
                                            <template slot="prepend">{{child3.name}}</template>
                                            <template slot="append">{{child3.nameAppend?child3.nameAppend:''}}
                                            </template>
                                          </el-input>
                                        </el-form-item>
                                      </div>
                                    </div>
                                  </div>
                                  <div v-if="child2.mathTypeName === '填写'" class="divTwo">
                                    <el-form-item label-width="0">
                                      <el-input :disabled="isLook"
                                                size="mini"
                                                v-model.trim="child2.value"
                                                :type="child2.inputTypeName === '数字' ? 'number' : ''"
                                                style="width: 80%">
                                        <template slot="prepend">{{child2.name}}</template>
                                      </el-input>
                                    </el-form-item>
                                  </div>
                                </div>
                              </el-col>
                              <el-col :span="24">
                                <div v-for="(child2,index1) in child1.childList" :key="index1">
                                  <div v-if="child2.mathTypeName === '列表'" class="list_view">
                                    <el-button type="primary" class="btnWeiZhi"
                                               style="margin-top: 10px"
                                               @click="addList([item,child1,child2])">添加位置信息
                                    </el-button>
                                    <table v-for="(child3,index1) in child2.itemList" :key="index1+1"
                                           v-show="index1===0">
                                      <tr>
                                        <th width="50px">序号</th>
                                        <th v-for="(child4,index2) in child3" :key="index2+1">
                                          <div v-if="child4.mathTypeName !== '不计分'">
                                            {{child4.name}}
                                          </div>
                                          <div v-else>
                                            位置描述
                                          </div>
                                        </th>
                                        <th>
                                          操作
                                        </th>
                                      </tr>
                                      <tr v-for="(child3,index1) in child2.itemList" :key="index1+1">
                                        <td>{{index1+1}}</td>
                                        <td v-for="(child4,index2) in child3" :key="index2"
                                            :class="{'picTd':child4.mathTypeName === '照片','radioTd':child4.inputList==''}">
                                          <div v-if="child4.mathTypeName === '不计分'">
                                            <div v-for="(child5,index3) in child4.childList" :key="index3"
                                                 style="width: 50%;display: inline-block">
                                              <div v-if="child5.mathTypeName === '填写'">
                                                <el-form-item label-width="0">
                                                  <el-input :disabled="isLook"
                                                            size="mini"
                                                            v-model.trim="child5.value"
                                                            :type="child5.inputTypeName === '数字' ? 'number' : ''"
                                                            style="width: 70%">
                                                    <template slot="prepend">{{child5.name}}</template>
                                                    <template slot="append">{{child5.nameAppend?child5.nameAppend:''}}
                                                    </template>
                                                  </el-input>
                                                </el-form-item>
                                              </div>
                                              <div v-if="child5.mathTypeName === '单选'">
                                                <el-row class="el-row1" style="background:transparent">
                                                  <el-col style="height: 28px" :span="6">{{child5.name}}</el-col>
                                                  <el-col style="height: 28px" :span="18">
                                                    <el-select
                                                      filterable
                                                      clearable
                                                      :disabled="isLook" size="small"
                                                      v-model="child5.value">
                                                      <el-option
                                                        v-for="option in child5.childList"
                                                        :key="option.id?option.id:option.code"
                                                        :label="option.name"
                                                        :value="option.id?option.id:option.code">
                                                      </el-option>
                                                    </el-select>
                                                  </el-col>
                                                </el-row>
                                              </div>
                                            </div>
                                          </div>
                                          <div v-if="child4.mathTypeName === '填写'">
                                            <el-form-item label-width="0">
                                              <el-input :disabled="isLook"
                                                        size="mini"
                                                        v-model.trim="child4.value"
                                                        :type="child4.inputTypeName === '数字' ? 'number' : ''"
                                                        style="width: 80%">
                                                <template slot="prepend">{{child4.name}}</template>
                                              </el-input>
                                            </el-form-item>
                                          </div>
                                          <div v-if="child4.mathTypeName === '单选'">
                                            <!--                                      {{child4.inputList.length}}-->
                                            <el-radio-group :disabled="isLook" size="mini" v-model="child4.value"
                                                            style="width: 100%"
                                                            @change="((val)=>{changeListSingleInput(val,child4.childList,[item,child1,child2],index1,index2)})"
                                            >
                                              <el-radio-button

                                                v-for="option in child4.childList"
                                                :key="option.id?option.id:option.code"
                                                :label="option.id?option.id:option.code">
                                                {{ option.name }}
                                              </el-radio-button>
                                            </el-radio-group>


                                            <!-- 单选对应的输入框-->
                                            <div v-for="child5 in child4.inputList" :key="child5.id"
                                                 style=" width: 120px;display: inline-block">
                                              <div v-if="child5.mathTypeName === '填写'"
                                                   style="display: inline-block;margin-bottom: 2px;width: 100%">
                                                <el-form-item label-width="0">
                                                  <el-input :disabled="isLook"
                                                            size="mini"
                                                            v-model.trim="child5.value"
                                                            :type="child5.inputTypeName === '数字' ? 'number' : ''"
                                                            style="width: 100%">
                                                    <template slot="prepend">{{child5.name}}</template>
                                                    <template slot="append">{{child5.nameAppend?child5.nameAppend:''}}
                                                    </template>
                                                  </el-input>
                                                </el-form-item>
                                              </div>
                                            </div>
                                          </div>
                                          <div v-if="child4.mathTypeName === '照片'">

                                            <div v-if="child4.pic && child4.pic.url" class="picBox1">

                                              <el-button v-if="!isLook" type="danger" icon="el-icon-delete" circle
                                                         @click="deletePic([item,child1,child2],index1,index2)"
                                                         style="font-size:16px">

                                              </el-button>

                                              <el-image
                                                @click="_previewImg(0,child4.pic)"
                                                style="height: 50px"
                                                fit="scale-down"
                                                :src="constUrl + child4.pic.url"></el-image>


                                            </div>
                                            <upload-img
                                              v-else
                                              trigger="button"
                                              :size-limit="5"
                                              v-model="child4.url"
                                              @update="setFormImg(child4.url,[item,child1,child2],index1,index2)"></upload-img>


                                            <div v-if="child4.pic" class="pic-no-view"> {{child4.pic.name}}</div>


                                          </div>
                                        </td>
                                        <td>
                                          <el-button type="text"
                                                     @click="(targetName)=>removeTab([item,child1,child2],targetName)"
                                                     style="color: red">
                                            删除
                                          </el-button>
                                        </td>

                                      </tr>
                                    </table>
                                  </div>
                                </div>
                              </el-col>
                            </el-row>
                          </div>
                          <div v-else-if="child1.mathTypeName === '权重'">
                            <el-form-item class="divTwo" style="padding-bottom: 10px"
                                          v-if="child1.name==='(C4)窗式(浆砌)护面墙'">
                              <el-radio-group :disabled="isLook" v-model="child1.isJiang"
                                              @change="((val)=>{changeJiang(val,[item,child1])})">
                                <el-radio-button label="1">浆砌片石墙面</el-radio-button>
                                <el-radio-button label="0">非浆砌片石墙面</el-radio-button>
                              </el-radio-group>
                            </el-form-item>
                            <div class="collapse_view2">
                              <el-collapse v-model="collapseActiveName2" @change="(val)=>onChangeCollapse(val,2)"
                                           accordion>
                                <el-collapse-item v-for="child2 in child1.childList" :title="child2.name"
                                                  :key="child2.id"
                                                  :name="child2.name"
                                                  v-show="(child2.name==='(C42)鼓胀(浆砌片石挡墙)' && child1.isJiang === '1') ||
                                                  (child2.name==='(C41)墙体开裂' && child1.isJiang) ||
                                                   (child2.name!=='(C42)鼓胀(浆砌片石挡墙)' && child2.name!=='(C41)墙体开裂')">
                                  <div v-for="child3 in child2.childList" :key="child3.id"
                                       style="margin-top: 10px;width: 50%;display: inline-block">
                                    <div v-if="child3.mathTypeName === '单选'" class="divTwo">
                                      <el-form-item label-width="180px">
                                        <span slot="label">
                                        <el-popover placement="top" trigger="click">
                                          <el-image :src="require(tips.img + '')" fit="contain"></el-image>
                                           <i slot="reference" class="el-icon-question tips" v-if="child3.name === '标度'"
                                              @click="showTips(child2.name)"></i>
                                        </el-popover>{{child3.name}}</span>
                                        <el-select
                                          filterable
                                          clearable
                                          :disabled="isLook" size="small"
                                          v-model="child3.value"
                                          @change="((val)=>{changeSingleInput(val,[item,child1,child2,child3])})">
                                          <el-option
                                            v-for="option in child3.childList"
                                            :disabled="option.code === 5&&child3.name === '标度'&&child1.isJiang === '0'"
                                            :key="option.id?option.id:option.code"
                                            :label="option.name"
                                            :value="option.id?option.id:option.code">
                                          </el-option>
                                        </el-select>
                                      </el-form-item>
                                      <!-- 单选对应的输入框-->
                                      <table style="width: 200%;margin-left: -100%">
                                        <tr class="tableHeader">
                                          <th v-for="(child4,index) in child3.inputList" :key="child4.id"
                                              :class="{'lastTh':!index}">
                                            {{child4.name}}
                                          </th>
                                        </tr>
                                        <tr>
                                          <td v-for="child4 in child3.inputList" :key="child4.id">
                                            <el-input :disabled="isLook"
                                                      size="mini"
                                                      v-model.trim="child4.value"

                                                      :type="child4.inputTypeName === '数字' ? 'number' : ''"
                                                      style="width:70%">
                                            </el-input>
                                            {{child4.nameAppend?child4.nameAppend:''}}
                                          </td>
                                        </tr>
                                      </table>
                                    </div>
                                    <!-- 不能放在单选里面不然 会因为判断不显示-->
                                    <div v-if="child3.mathTypeName === '计算填写'" style="width:  200%;height: 40px;">
                                      <div style="width: 100%">
                                        <div>
                                          <span style="color: #1990FE  ;margin-right: 10px;">{{child3.name}}</span>
                                          <el-input :disabled="isLook"
                                                    size="mini"
                                                    v-model.trim="child3.value"
                                                    :type="child2.inputTypeName === '数字' ? 'number' : ''"
                                                    style="width:70%"
                                          >
                                          </el-input>
                                        </div>
                                      </div>
                                    </div>
                                    <div v-if="child3.mathTypeName === '填写'">
                                      <div style="width: 100%;">
                                        <div>

                                          <el-input :disabled="isLook"
                                                    size="mini"
                                                    v-model.trim="child3.value"
                                                    :type="child2.inputTypeName === '数字' ? 'number' : ''"
                                                    style="width:40%"
                                          >
                                            <template slot="prepend">{{child3.name}}</template>
                                            <template slot="append">{{child3.nameAppend?child3.nameAppend:''}}
                                            </template>
                                          </el-input>
                                        </div>
                                      </div>
                                    </div>
                                  </div>
                                  <div v-for="(child3,index3) in child2.childList" :key="index3">
                                    <div v-if="child3.mathTypeName === '列表'" class="list_view">
                                      <el-button type="primary"
                                                 class="btnWeiZhi"
                                                 @click="addList([item,child1,child2,child3])">添加位置信息
                                      </el-button>
                                      <table v-for="(child4,index1) in child3.itemList" :key="index1"
                                             v-show="index1===0">
                                        <tr>
                                          <th width="50px">序号</th>
                                          <th v-for="(child5,index2) in child4" :key="index2">
                                            <div v-if="child5.mathTypeName !== '不计分'">
                                              <el-popover placement="top" trigger="click">
                                                <el-image :src="require(tips.img + '')" fit="contain"></el-image>
                                                <i slot="reference" class="el-icon-question tips"
                                                   v-if="child5.name === '受损锚头标度' || child5.name === '标度'"
                                                   @click="showTips(child2.name)"></i>
                                              </el-popover>
                                              {{child5.name}}
                                            </div>
                                            <div v-else>
                                              位置描述
                                            </div>
                                          </th>
                                          <th>
                                            操作
                                          </th>
                                        </tr>
                                        <tr v-for="(child4,index1) in child3.itemList" :key="index1+1">
                                          <td>{{index1+1}}</td>
                                          <td v-for="(child5,index2) in child4" :key="index2"
                                              :class="{'picTd':child5.mathTypeName === '照片'}">
                                            <div v-if="child5.mathTypeName === '不计分'">
                                              <div v-for="(child6,index3) in child5.childList" :key="index3">
                                                <div v-if="child6.mathTypeName === '填写'">
                                                  <el-form-item label-width="0">
                                                    <el-input :disabled="isLook"
                                                              size="mini"
                                                              v-model.trim="child6.value"
                                                              :type="child6.inputTypeName === '数字' ? 'number' : ''"
                                                              style="width: 80%;margin-top: 10px">
                                                      <template slot="prepend">{{child6.name}}</template>
                                                      <template slot="append">{{child6.nameAppend?child6.nameAppend:''}}
                                                      </template>
                                                    </el-input>
                                                  </el-form-item>
                                                </div>
                                                <div v-if="child6.mathTypeName === '单选'">
                                                  <el-row class="el-row1" style="background: #1990FE">
                                                    <el-col style="color: white">{{child6.name}}</el-col>
                                                  </el-row>
                                                  <el-row>
                                                    <el-col>
                                                      <el-radio-group :disabled="isLook" size="small"
                                                                      v-model="child6.value">
                                                        <el-radio-button
                                                          v-for="option in child6.childList"
                                                          :key="option.id?option.id:option.code"
                                                          :label="option.id?option.id:option.code">
                                                          {{ option.name }}
                                                        </el-radio-button>
                                                      </el-radio-group>

                                                    </el-col>
                                                  </el-row>

                                                </div>
                                              </div>
                                            </div>
                                            <div v-if="child5.mathTypeName === '填写'">
                                              <el-form-item label-width="0">
                                                <el-input :disabled="isLook"
                                                          size="mini"
                                                          v-model.trim="child5.value"
                                                          :type="child5.inputTypeName === '数字' ? 'number' : ''"
                                                          style="width: 80%">
                                                  <template slot="prepend">{{child5.name}}</template>
                                                  <template slot="append">{{child5.nameAppend?child5.nameAppend:''}}
                                                  </template>
                                                </el-input>
                                              </el-form-item>
                                            </div>
                                            <div v-if="child5.mathTypeName === '单选'" style="display: inline-block">
                                              <el-radio-group :disabled="isLook" style="width: 100%" size="mini"
                                                              v-model="child5.value"
                                                              @change="((val)=>{changeListSingleInput(val,child5.childList,[item,child1,child2,child3],index1,index2)})">
                                                <el-radio-button
                                                  v-for="option in child5.childList"
                                                  :key="option.id?option.id:option.code"
                                                  :label="option.id?option.id:option.code">
                                                  {{ option.name }}
                                                </el-radio-button>
                                              </el-radio-group>


                                              <!-- 单选对应的输入框-->
                                              <div v-for="child6 in child5.inputList" :key="child6.id"
                                                   style=" width: 170px;display: inline-block">
                                                <div v-if="child6.mathTypeName === '填写'">
                                                  <el-form-item label-width="0">
                                                    <el-input :disabled="isLook"
                                                              size="mini"
                                                              v-model.trim="child6.value"
                                                              :type="child5.inputTypeName === '数字' ? 'number' : ''"
                                                              style="width: 100%">
                                                      <template slot="prepend">{{child6.name}}</template>
                                                      <template slot="append">{{child6.nameAppend?child6.nameAppend:''}}
                                                      </template>
                                                    </el-input>
                                                  </el-form-item>
                                                </div>
                                              </div>
                                            </div>
                                            <div v-if="child5.mathTypeName === '照片'">

                                              <div v-if="child5.pic && child5.pic.url" class="picBox1">

                                                <el-button v-if="!isLook" type="danger" icon="el-icon-delete" circle
                                                           @click="deletePic([item,child1,child2,child3],index1,index2)"
                                                           style="font-size:16px">

                                                </el-button>

                                                <el-image
                                                  @click="_previewImg(0,child5.pic)"
                                                  style="height: 50px"
                                                  fit="scale-down"
                                                  :src="constUrl + child5.pic.url"></el-image>


                                              </div>
                                              <upload-img
                                                v-else
                                                trigger="button"
                                                :size-limit="5"
                                                v-model="child5.url"
                                                @update="setFormImg(child5.url,[item,child1,child2,child3],index1,index2)"></upload-img>
                                              <div v-if="child5.pic" class="pic-no-view"> {{child5.pic.name}}</div>
                                            </div>
                                          </td>
                                          <td>
                                            <el-button type="text"
                                                       @click="(targetName)=>removeTab([item,child1,child2,child3],targetName)"
                                                       style="color: red">
                                              删除
                                            </el-button>
                                          </td>
                                        </tr>
                                      </table>
                                    </div>
                                  </div>
                                </el-collapse-item>
                              </el-collapse>
                            </div>
                          </div>
                        </el-collapse-item>
                      </el-collapse>
                    </div>
                  </div>
                </div>
              </el-tab-pane>
            </el-tabs>
          </el-card>
        </div>
        <div v-else>
          <el-form-item label="相关照片" prop="projectInfoImgList">
            <upload-img v-model="currentRow.singleControlPic" :limit="6" :size-limit="6"
                        ref="uploadPic"></upload-img>
          </el-form-item>
        </div>
      </el-card>
      <div class="button-foot">
        <!--        <el-button-->
        <!--          class="common_btn-defalut"-->
        <!--          type="primary"-->
        <!--          @click="validatorForm">提交记录-->
        <!--        </el-button>-->
      </div>
    </el-form>
    <picture-viewer ref="imageViewer"></picture-viewer>
  </div>
</template>

<script>
  import {getTemplateContent, putTechnicalForm} from "@/services/model/form";
  import ItemMixins from "../item.mixins";
  import UploadImg from "@/components/upload-img";
  import Organization from "@/components/organization-unit/all";
  import PictureViewer from "@/components/picture-viewer/index-name";
  import Enums from '@/utils/enums'

  export default {
    components: {UploadImg, Organization, PictureViewer},
    mixins: [ItemMixins,Enums],
    data() {
      return {
        isLook: false,
        rules: {
          deptTreeId: {required: true, message: "请选择管养单位"},
          roadId: {required: true, message: "请选择路线"},
          slopeId: {required: true, message: "请选择边坡"},
          investigationTime: {required: true, message: "请选择调查时间"},
          investigationDeptTreeId: {required: true, message: "请选择调查单位"},
          investigator: {required: true, message: "请输入调查人姓名"},
        },
        collapseActiveName1: "",
        collapseActiveName2: "",
        activeName: '(B)坡体',
        tabListActive: "序号1",
        currentRow: {
          investigationTime: new Date().getTime()
        },
        template: [],
        weightList: [],
        selectIdList: [],
        EnumTechniqueSingleControlList: [],
        listIndex1: 0,
        listIndex2: 0,
      };
    },
    computed: {
      userInfo() {
        return this.$store.state.userInfo;
      },
    },
    methods: {
      changeJiang(value, item) {
        this.template.map(a => {
          if (a.id === item[0].id) {
            a.childList.map(b => {
              if (b.id === item[1].id) {
                b.childList.map(c => {
                  if (c.name === '(C41)墙体开裂') {
                    c.childList.map(d => {
                      if (d.name === '标度') {
                        d.value = null;
                      }
                    })
                  }
                })
              }
            })
          }
        })
        this.assignmentHandel(item)
        this.handleData(this.template, 0, null, null, null, null, value)
        this.$forceUpdate()
      },
      changeSingleControl(code) {
        this.currentRow.singleControl = this.currentRow.singleControl === code ? '' : code
        this.$forceUpdate()
      },
      //刷新单选框回显
      updateRadio() {
        this.$forceUpdate()
      },
      quanz(val) {
        //一个权重只能选一次
        this.weightList.map(x => {
          if (x.code === val) {
            x.disabled = true
          }
        })
        this.$forceUpdate()
      },
      changeJiePaiShui(val, item) {
        //展示处理
        let paiShuiWeightList1 = [0.2, 0.5, 0.3]
        let paiShuiWeightList2 = [0.29, 0.71, 0]
        let paiShuiWeightList3 = [0.40, 0, 0.60]
        // if(this.template.length===1){
        //
        // }
        this.template.map(x => {
          if (x.id === item.id) {
            x.childList.map((y, index) => {
              //只有(D1)坡面渗水一直显示
              y.show = false
              y.weight = ''
              y.weightName = ''
              if (val.indexOf(y.id) > -1) {
                y.show = true
                if (val.length == 3) {
                  paiShuiWeightList1.map((b, index) => {
                    x.childList[index + 1].weight = paiShuiWeightList1[index]
                  })
                } else if (val.length == 2) {
                  val.map(a => {
                    if (val.indexOf('3002') > -1) {
                      paiShuiWeightList2.map((b, index) => {
                        x.childList[index + 1].weight = paiShuiWeightList2[index]
                      })
                    } else if (val.indexOf('3003') > -1) {
                      paiShuiWeightList3.map((b, index) => {
                        x.childList[index + 1].weight = paiShuiWeightList3[index]
                      })
                    }
                  })
                }
              }
            })
          }
        })
        this.$forceUpdate();
      },
      changePoMianFangHu(val, item) {
        let weight = null;
        if (val.length !== 0) {
          weight = 1 / val.length
        }
        //展示处理
        this.template.map(x => {
          if (x.id === item.id) {
            x.childList.map(y => {
              y.show = false
              y.weight = ''
              y.weightName = ''
              if (val.indexOf(y.id) > -1) {
                y.show = true
                y.weight = weight
              }
            })
          }
        })
        this.$forceUpdate();
      },
      changeZhiHu(val, item) {
        //支护数量，用于选择权重
        let weightList = []
        for (let i = 0; i < val.length; i++) {
          let temp = this.getWeight(val.length - 1, i)
          let weight = {
            name: temp,
            code: temp,
            disabled: false,
          }
          weightList.push(weight)
        }
        this.weightList = weightList
        //展示处理
        this.template.map(x => {
          if (x.id === item.id) {
            x.childList.map(y => {
              y.show = false
              y.weight = ''
              y.weightName = ''
              if (val.indexOf(y.id) > -1) {
                y.show = true
              }
            })
          }
        })
      },
      getPaiShuiWeight(num, index) {
        let weightList = [
          [1],
          [0.6, 0.4],
          [0.5, 0.3, 0.2],
          [0.4, 0.3, 0.2, 0.1],
          [0.3, 0.25, 0.2, 0.15, 0.1]
        ]
        return weightList[num][index]
      },
      //根据勾选支护数量，分配权重，最多三
      getWeight(num, index) {
        let weightList = [
          [1],
          [0.6, 0.4],
          [0.5, 0.3, 0.2],
          [0.4, 0.3, 0.2, 0.1],
          [0.3, 0.25, 0.2, 0.15, 0.1]
        ]
        return weightList[num][index]
      },
      handleClick(val) {
        this.tabListActive = val.name
      },
      // 查看大图
      _previewImg(index, pic) {
        const urlList = [];
        urlList.push({
          url: this.constUrl + pic.url,
          name: pic.name
        });
        // 显示照片查看器
        this.$refs.imageViewer.showViewer(urlList, index);
      },
      deletePic(item, index1, index2) {
        this.selectItem = item[item.length - 1]
        let selectIdList = []
        item.map(x => {
          selectIdList.push(x.id)
        })
        this.selectIdList = selectIdList
        this.listIndex1 = index1
        this.listIndex2 = index2
        this.handleData(this.template, 0, null, {})
        this.$forceUpdate()
      },
      assignmentHandel(item) {
        this.selectItem = item[item.length - 1]
        let selectIdList = []
        item.map(x => {
          selectIdList.push(x.id)
        })
        this.selectIdList = selectIdList
      },
      changeSingleInput(value, item) {
        this.assignmentHandel(item)
        let inputList = []
        this.selectItem.childList.map(x => {
          if (x.id === value) {
            inputList = x.childList
          }
        })
        this.handleData(this.template, 0, null, null, null, inputList)
        this.$forceUpdate()
      },
      //动态列表中，单选框有输入框的情况
      changeListSingleInput(value, childList, item, index1, index2) {
        this.assignmentHandel(item, index1, index2)
        this.listIndex1 = index1
        this.listIndex2 = index2
        let listInputList = []
        childList.map(x => {
          if (x.id === value) {
            listInputList = x.childList
          }
        })
        this.handleData(this.template, 0, null, null, listInputList)
        this.$forceUpdate()
      },
      // 上传成功后处理图片
      setFormImg(path, item, index1, index2) {
        if (!path) {
          return
        }
        this.assignmentHandel(item)
        this.listIndex1 = index1
        this.listIndex2 = index2
        let no = "00"
        if (index2 < 9) {
          no = no + (index1 + 1)
        } else {
          no = "0" + (index1 + 1)
        }
        let picNo = '请先选择边坡，用于生成照片编号！'
        if (this.slopeInfo) {
          picNo = this.slopeInfo.slopeNo + "-" + this.timeFormat(new Date(), 'yyyyMMdd') + "-" + this.selectItem.algebra + "-" + no
        }
        let pic = {
          name: picNo, //照片编号SID-DATE-B1-001，边坡id+时间+调查项编号+序号
          url: path[0]
        }
        this.handleData(this.template, 0, null, pic)
      },
      //动态删除列表
      removeTab(item, index) {
        if (this.isLook) {
          return
        }
        //从【序号1】中，取索引值
        index = index[2] - 1
        this.assignmentHandel(item)
        let itemList = this.selectItem.itemList || []
        itemList.splice(index, 1)
        this.handleData(this.template, 0, itemList)
        this.tabListActive = '序号' + itemList.length
      },
      //动态添加列表
      addList(item) {
        if (this.isLook) {
          return
        }
        this.assignmentHandel(item)
        let itemList = this.selectItem.itemList || []
        //不同引用，完全copy对象
        itemList.push(JSON.parse(JSON.stringify(this.selectItem.childList)))
        this.handleData(this.template, 0, itemList)
        this.tabListActive = '序号' + itemList.length
      },
      //递归处理列表赋值对象
      handleData(temp, idIndex, itemList, pic, listInputList, inputList, jiangValue) {
        temp.map(x => {
          if (this.selectItem.id === x.id) {
            if (itemList) {
              x.itemList = itemList
            }
            if (pic) {
              x.itemList[this.listIndex1][this.listIndex2].pic = pic
            }
            //动态列表中的单选包含输入框
            if (listInputList) {
              x.itemList[this.listIndex1][this.listIndex2].inputList = listInputList
            }
            //单选包含输入框
            if (inputList) {
              x.inputList = inputList
            }
            //是否是浆砌片石面墙（更改两个子选项的权重）
            if (jiangValue) {
              x.childList.map(x => {
                if (x.name === '(C41)墙体开裂') {
                  x.weight = jiangValue === '1' ? 0.5 : 1
                }
                if (x.name === '(C42)鼓胀(浆砌片石挡墙)') {
                  x.weight = jiangValue === '1' ? 0.5 : 0
                }
              })
            }
            return
          }
          //匹配父级选项
          if (this.selectIdList[idIndex] === x.id) {
            idIndex++
            if (x.childList) {
              this.handleData(x.childList, idIndex, itemList, pic, listInputList, inputList, jiangValue)
            }
          }
        })
      },
      changeSlope() {
        this.getSlopeInfo(this.currentRow.slopeId)
      },
      //折叠面板
      onChangeCollapse(val, num) {
        this[`collapseActiveName1${num}`] = val
      },
      //获取路线列表
      async changeDept() {
        let list = await this.getRoadListByDept(this.currentRow.deptTreeId);
        if (list.length > 0) {
          this.$set(this.currentRow, "roadId", list[0].id);
          this.changeRoad()
        } else {
          this.$set(this.currentRow, "roadId", "");
          this.$set(this.currentRow, "slopeId", "");
        }
      },
      async getTemplate() {
        let res = await getTemplateContent({formType: 7});
        this.template = res.data;
      },
      // 新增编辑提交数据
      async submitData() {
        this.currentRow.formJson = JSON.stringify(this.template);
        let res = await putTechnicalForm(this.currentRow);
        try {
          if (res.code === 200) {
            this.currentRow = {};
            this.$notify({
              type: "success",
              title: "提示",
              message: "添加成功",
            });
            this.$emit("submitClose");
          }
        }catch (e) {
          this.$emit("changedis", false)
        }
      },
      // 表单校验
      validatorForm() {
        return new Promise((resolve) => {
          this.$refs.form.validate((valid) => {
            if (valid && resolve) {
              this.$emit("changedis", true)
              this.submitData();

            }
          });
        });
      },
      //查询灾害点列表
      async changeRoad() {
        this.slopeSelectList = [];
        const {roadId, deptTreeId} = this.currentRow;
        let list = await this.getSelectSlopeList(deptTreeId, roadId)
        if (list.length > 0) {
          this.$set(this.currentRow, "slopeId", list[0].id);
          this.getSlopeInfo(list[0].id)
        } else {
          this.$set(this.currentRow, "slopeId", "");
        }
      },
    },
    mounted() {
      this.getTemplate()
      this.currentRow.investigationDeptTreeId = this.$store.state.userInfo.organizationId;
      // 启用状态枚举
      this.queryDictList(['EnumTechniqueSingleControl'], ['EnumTechniqueSingleControlList'])
    },
    activated() {
    },
  };
</script>
<style lang="less" scoped>
  /deep/ .el-collapse .el-collapse-item__content {
    padding: 0 !important;
  }

  .hover_card {
    height: 100px;
    line-height: 90px;
    font-size: 20px;
    margin-top: 10px;
  }

  .select_card {
    height: 100px;
    line-height: 90px;
    font-size: 20px;
    margin-top: 10px;
    background-color: #1990FE;
    color: white;
  }

  .page_monitor-add {
    /*width: 1200px;*/
    margin: 0 auto;

    .page-title {
      margin-bottom: 20px;
      padding: 28px;
      font-size: 30px;
      line-height: 18px;
      text-align: center;
      color: #1990FE;
      font-weight: 600;
      border-radius: 20px;
      /*background: #1990FE !important;*/
      box-shadow: 0px 0px 4px #161616;
      /*border: 1px solid #161616;*/
      margin-top: 10px;
    }

    /deep/ .el-tabs__item.is-active {
      font-size: 20px;
      border-radius: 5px;
      font-weight: 600;
    }

    /deep/ .el-tabs__item {
      font-size: 20px;
    }
  }

  .form_box {
    padding: 20px;
  }

  .s-white {
    color: #ffffff;
  }

  .el-steps--simple {
    margin-bottom: 20px;
  }

  .button-foot {
    margin-top: 10px;
    text-align: center;
    padding: 10px;

    .el-button {
      background: #1990FE;
      border: none;
    }
  }

  .paicha_view {
    height: 600px;
    overflow: auto;
    background-color: white;

    /deep/ .el-input__inner {
      padding: 0 !important;
      padding-left: 10px !important;
    }

    /deep/ .el-checkbox-button.is-checked .el-checkbox-button__inner {
      background-color: #1990FE;
      border-color: #1990FE
    }

    /deep/ .el-collapse .el-collapse-item__header .is-active {
      color: #fff;
    }

    .el-tabs__content {
      /*background-color: #1b1b1b;*/
      padding: 10px;

    }

    /deep/ .el-collapse-item__header {
      border: 1px solid #1990FE;
      color: #1990FE;
    }

    /deep/ .el-tabs__header {
      margin: 0;
    }

    /deep/ .el-input-group__prepend {
      color: #1990FE;
      padding: 0 5px;
      background-color: transparent;
      border: none;
    }

    /deep/ .el-input-group__append {
      padding: 0 5px;
      background-color: transparent;
      border: none;
    }

    /deep/ .el-collapse-item__header {
      border-radius: 5px;
      margin-top: 10px;
    }

    /deep/ .el-collapse-item__header.is-active {
      background-color: #1990FE;
      color: #ffffff !important;
      border-radius: 5px;
    }

    /deep/ .el-tabs {
      padding-left: 40px;
      padding-bottom: 10px;

      .el-tabs__active-bar {
        background: #1990FE;

      }

      .el-tabs__item {
        color: #1990FE;
      }

      .is-active {
        color: #1990FE;
        font-weight: 600;
        border: none;
      }

      .el-radio-button {
        span:hover {
          color: white;
          background: #1990FE;


        }
      }
    }

    .select_card {
    }

    /deep/ .el-input--suffix .el-input__inner {
      // background: #1990FE !important;
      color: #1990FE;
    }

    /deep/ .el-card {
      box-shadow: 4px 6px 8px #757575;
      color: white;
      background-color: white;
      box-shadow: none;
      padding-bottom: 20px;
      // font-size: 140%;
    }
  }

  .select_card {
    background: #1990FE !important;
    font-size: 200%;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    /*box-shadow: 4px 6px 2px #161616 !important;*/
  }

  /deep/ .hiddenDangerFormCard {
    background: red !important;
  }

  .hover_card:hover {
    background: #1990FE !important;
  }

  // 设置 fromlabel 文字颜色


  // 设置单选框选中颜色
  .el-radio-button__orig-radio:checked + .el-radio-button__inner {
    background: #1990FE;
    border-color: #1990FE;
  }

  .paicha_view .el-card {
    border: 1px solid #1990FE !important;
  }

  .clearfix:before,
  .clearfix:after {
    display: table;
    content: "";
  }

  .clearfix:after {
    clear: both
  }

  .box-card {
    width: 100%;
  }

  .pic-no-view {
    color: white;
    background-color: #1990FE;
  }

  .list_view {
    .el-tabs__content {
      background-color: #f1f1f1;
      padding: 10px;
    }
  }

  .collapse_view2 {
    .el-collapse-item__header {
      height: 40px;
    }

    .el-collapse .el-collapse-item__header {
      background-color: #1990FE;
      color: #fff !important;
    }

    .el-collapse .el-collapse-item__header.is-active {
      background-color: #1990FE !important;
      color: #fff;
      font-size: 15px;
    }

    .el-collapse .el-collapse-item__header .is-active {
      color: #fff;
    }
  }

  .label_view {
    display: inline-block;
    color: #1990FE;
    font-weight: 600;
    text-align: left;
    font-size: 18px;
    line-height: 25px;
    width: 90px;
  }

  .info_view {
    text-align: left;
  }


  .btnWeiZhi {
    width: 28%;
    margin-bottom: 10px;;
    background: #1990FE;
    border-radius: 20px;
    /*margin-left: 700px*/
  }

  .div3 {
    display: inline-block;
    width: 20%;
    margin-left: 15px;
  }


  .tianXie {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
  }


  #divOne {
    border-bottom: 1px solid #1990FE;
    padding-top: 10px;

  }

  .divTwo {

    border-bottom: 1px solid #1990FE;
    padding-top: 10px;
  }

  .divThree {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: red;
  }

  .danXuanBtn {
    width: 100px;

    display: flex;
    justify-content: center;
    align-items: center;
    height: 20px;


  }

  .tdDiv {
    padding: 10px 0;

  }

  .picBox {

    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 80%;
    height: 100px;
    margin: auto;
  }

  .picBox1 {

    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 80%;
    height: 50px;
    margin: auto;
  }

  .fillWrite {
    display: inline-block;
    width: 32%;
    text-align: left;

    height: 65px;
    line-height: 65px;

  }

  .fillWrite2 {
    border: none;
  }

  .picTd {
    width: 150px;
    /*background: yellow;*/
  }

  .radioTd {
    width: 150px;
  }

  .investigationBox {
    .el-input__inner {
      padding-left: 30px !important;
    }
  }
</style>
<style scoped lang="less">
  .el-input__inner {
    padding: 0 !important;
    padding-left: 10px !important;
  }

  /*  table*/
  table {
    width: 100%;
    /*margin-top: 10px;*/

    tr {
      border: 1px solid #1990FE;

      th {
        align-items: center;
        line-height: 34px;
        height: 34px;
        font-size: 14px;
        color: white;
        background: #1990FE;
        border-left: 1px solid white;

      }

      .lastTh {
        border-left: none;
      }

      td {
        min-width: 50px;
        align-items: center;
        display: table-cell;
        vertical-align: middle;
        border: 1px solid #1990FE;
        text-align: center;
        box-sizing: border-box;
        /*padding: 10px 0;*/
        valign: middle;
        align: center;
        height: 40px;
        line-height: 40px;


        /deep/ .el-input__inner {
          border: none;
          border-bottom: 1px solid #1990FE;
          border-radius: 0;
        }
      }
    }

    .tableHeader {
      border: 1px solid #1990FE
    }
  }

  .el-divider--horizontal {
    margin: 30px 0;
  }

  .tips {
    font-size: 20px;
    color: #ffbf00;
    margin-right: 5px;
    cursor: pointer;
  }
</style>
